<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>子组件获取父组件的数据</title>
    <script src="../lib/vue.js"></script>
</head>
<body>

<div id="box">
    <aaa></aaa>
</div>
    <template id="temp-a">
        <div>
            <h3>父组件->{{msg}}</h3>
            <bbb :mb="msg" :my-msg="msg2"></bbb>
        </div>
    </template>

    <template id="temp-b">
        <p>子组件->{{mb}}   {{myMsg}}</p>
    </template>



<script>

    var vm = new Vue({
        el: '#box',
        components: {
            'aaa': {
                template: '#temp-a',
                data: function () {
                    return {
                        msg: "我是父组件的数据",
                        msg2: 'msg2@@'
                    }
                },
                components: {
                    'bbb': {
                        template: '#temp-b',
                        props: ['mb','myMsg']
                    }
                }
            }
        }

    })
</script>
</body>
</html>